package com.itheima.demo.demo9;

import java.io.File;
import java.io.FileFilter;

public class File111 {
    public static void main(String[] args) {
        File file = new File("D:\\day01\\试炼.txt");
        method(file);
        }

    private static void method(File file) {
        File[] files = file.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                 return pathname.isDirectory() || pathname.getName().toLowerCase().endsWith(".java");
            }
        });
        for (File f : files) {
            if (f.isDirectory()){
                method(f);
            }else {
                System.out.println(f);
            }

        }

    }
}
